package com.aurora.app.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.aurora.app.dao.StoryTopicDao;
import com.aurora.app.entity.StoryTopic;
import com.aurora.base.dao.BaseDao;
import com.aurora.base.dto.Order;
import com.aurora.base.service.BaseService;

@Service
public class StoryTopicService extends BaseService<StoryTopic> {
	@Resource
	private StoryTopicDao baseDao;
	
	@Override
	public BaseDao<StoryTopic> getBaseDao() {
		// TODO Auto-generated method stub
		return this.baseDao;
	}
	
	
	/**
	 * 根据用户在专题下的文章收藏数量排序
	 * @param first
	 * @param max
	 * @return
	 */
	public List<StoryTopic> getListOrderByGuanZhu(int first,int max){
		Order order = new Order();
		order.put("like", Order.DESC);
		return this.baseDao.list(first,max,"o.isDelete = 0");
	}

	/**
	 * 根据排序好的排行排序
	 * @param first
	 * @param max
	 * @return
	 */
	public List<StoryTopic> getListOrderByCreateNum(int first,int max){
		Order order = new Order();
		order.put("rank", Order.ASC);
		return this.baseDao.list(order,first,max,"o.isDelete = 0");
	}
}
